package com.put.mybills.model;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.simpleframework.xml.Attribute;


public class Bill implements Comparable<Bill>{
	
	@Attribute(required=false)
	private Integer id;
	@Attribute(required=false)
	private Integer factureId;
	@Attribute(required=false)
	private String  name = "";
	@Attribute(required=false)
	private String  description  = "";
	@Attribute(required=false)
	private Double  price = 0.0;
	@Attribute(required=false)
	private String  date;
	@Attribute(required=false)
	private String 	DriveIDPicture = "";
	@Attribute(required=false)
	private String  picturePath = "";
	@Attribute(required=true)
	private int ifPaid = 0;
	
	public int getIfPaid() {
		return ifPaid;
	}
	public void setIfPaid(int ifPaid) {
		this.ifPaid = ifPaid;
	}

	private Date tmpDate;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getFactureId() {
		return factureId;
	}
	public void setFactureId(Integer factureId) {
		this.factureId = factureId;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public String getDriveIDPicture() {
		return DriveIDPicture;
	}
	public void setDriveIDPicture(String driveIDPicute) {
		DriveIDPicture = driveIDPicute;
	}
	public String getPicturePath() {
		return picturePath;
	}
	public void setPicturePath(String picturePath) {
		this.picturePath = picturePath;
	}	
	
	public Date getTmpDate() {
		return tmpDate;
	}
	public void setTmpDate(String tmpDate) {
		
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
		String dateInString = tmpDate;
		Date date = null;
		try {	 
			date = formatter.parse(dateInString);			
		}
		catch (Exception e) {}
		
		
		this.tmpDate = date;
	}
	
	@Override
	public int compareTo(Bill another) {		
		return this.getTmpDate().compareTo(another.getTmpDate());
	}
	

}
